
package nbcp.db.mysql.table

import nbcp.base.extend.*
import nbcp.base.utils.*
import nbcp.db.mysql.entity.*
import nbcp.db.mysql.*
import nbcp.db.*
import nbcp.db.sql.*

//generate auto @2019-09-10 11:56:28


class SystemGroup : IDataGroup {
    override fun getEntities():Set<SqlBaseTable<*>> = setOf(s_annex,s_log,s_login_user,s_user)

    val s_annex by lazy{ return@lazy s_annex_table(); }
    val s_log by lazy{ return@lazy s_log_table(); }
    val s_login_user by lazy{ return@lazy s_login_user_table(); }
    val s_user by lazy{ return@lazy s_user_table(); }


    
    class s_annex_table(datasource:String=""):SqlBaseTable<s_annex>(s_annex::class.java,"s_annex",datasource) {
        val id=SqlColumnName(DbType.Int,this.getAliaTableName(),"id")
        val name=SqlColumnName(DbType.String,this.getAliaTableName(),"name")
        val ext=SqlColumnName(DbType.String,this.getAliaTableName(),"ext")
        val size=SqlColumnName(DbType.Int,this.getAliaTableName(),"size")
        val checkCode=SqlColumnName(DbType.String,this.getAliaTableName(),"checkCode")
        val imgWidth=SqlColumnName(DbType.Int,this.getAliaTableName(),"imgWidth")
        val imgHeight=SqlColumnName(DbType.Int,this.getAliaTableName(),"imgHeight")
        val url=SqlColumnName(DbType.String,this.getAliaTableName(),"url")
        val createby_id=SqlColumnName(DbType.Int,this.getAliaTableName(),"createby_id")
        val createby_name=SqlColumnName(DbType.String,this.getAliaTableName(),"createby_name")
        val errorMsg=SqlColumnName(DbType.String,this.getAliaTableName(),"errorMsg")
        val createAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"createAt")
    
        override fun getAutoIncrementKey(): String { return "id"}
        override fun getUks(): Array<Array<String>>{ return arrayOf( arrayOf("id")  )}
        override fun getRks(): Array<Array<String>>{ return arrayOf( arrayOf("corp_id")  )}
        override fun getFks(): Array<FkDefine>{ return arrayOf(FkDefine("s_annex","createby_id","s_user","id") )}
    
    
        fun queryById (id: Int ): SqlQueryClip<s_annex_table, s_annex> {
            return this.query().where{ (it.id match_equal id) }
        }
    
    
        fun findById (id: Int ): s_annex? {
            return this.query().where{ (it.id match_equal id) }.limit(0,1).toEntity()
        }
    
        fun deleteById (id: Int ): SqlDeleteClip<s_annex_table,s_annex> {
            return this.delete().where{ (it.id match_equal id) }
        }
    
        fun updateById (id: Int ): SqlUpdateClip<s_annex_table,s_annex> {
            return this.update().where{ (it.id match_equal id) }
        }
    
    }
    
    class s_log_table(datasource:String=""):SqlBaseTable<s_log>(s_log::class.java,"s_log",datasource) {
        val id=SqlColumnName(DbType.Int,this.getAliaTableName(),"id")
        val msg=SqlColumnName(DbType.String,this.getAliaTableName(),"msg")
        val creatAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"creatAt")
        val createBy_id=SqlColumnName(DbType.String,this.getAliaTableName(),"createBy_id")
        val createBy_name=SqlColumnName(DbType.String,this.getAliaTableName(),"createBy_name")
        val type=SqlColumnName(DbType.String,this.getAliaTableName(),"type")
        val clientIp=SqlColumnName(DbType.String,this.getAliaTableName(),"clientIp")
        val module=SqlColumnName(DbType.String,this.getAliaTableName(),"module")
        val remark=SqlColumnName(DbType.String,this.getAliaTableName(),"remark")
    
        override fun getAutoIncrementKey(): String { return "id"}
        override fun getUks(): Array<Array<String>>{ return arrayOf( arrayOf("id")  )}
        override fun getRks(): Array<Array<String>>{ return arrayOf( )}
        override fun getFks(): Array<FkDefine>{ return arrayOf()}
    
    
        fun queryById (id: Int ): SqlQueryClip<s_log_table, s_log> {
            return this.query().where{ (it.id match_equal id) }
        }
    
    
        fun findById (id: Int ): s_log? {
            return this.query().where{ (it.id match_equal id) }.limit(0,1).toEntity()
        }
    
        fun deleteById (id: Int ): SqlDeleteClip<s_log_table,s_log> {
            return this.delete().where{ (it.id match_equal id) }
        }
    
        fun updateById (id: Int ): SqlUpdateClip<s_log_table,s_log> {
            return this.update().where{ (it.id match_equal id) }
        }
    
    }
    
    class s_login_user_table(datasource:String=""):SqlBaseTable<s_login_user>(s_login_user::class.java,"s_login_user",datasource) {
        val id=SqlColumnName(DbType.Int,this.getAliaTableName(),"id")
        val loginName=SqlColumnName(DbType.String,this.getAliaTableName(),"loginName")
        val password=SqlColumnName(DbType.String,this.getAliaTableName(),"password")
        val lastLoginAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"lastLoginAt")
        val errorCount=SqlColumnName(DbType.Int,this.getAliaTableName(),"errorCount")
        val forget_password=SqlColumnName(DbType.Boolean,this.getAliaTableName(),"forget_password")
        val updateAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"updateAt")
        val createAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"createAt")
    
        override fun getAutoIncrementKey(): String { return ""}
        override fun getUks(): Array<Array<String>>{ return arrayOf( arrayOf("id") , arrayOf("loginName")  )}
        override fun getRks(): Array<Array<String>>{ return arrayOf( )}
        override fun getFks(): Array<FkDefine>{ return arrayOf()}
    
    
        fun queryById (id: Int ): SqlQueryClip<s_login_user_table, s_login_user> {
            return this.query().where{ (it.id match_equal id) }
        }
    
    
        fun findById (id: Int ): s_login_user? {
            return this.query().where{ (it.id match_equal id) }.limit(0,1).toEntity()
        }
    
        fun deleteById (id: Int ): SqlDeleteClip<s_login_user_table,s_login_user> {
            return this.delete().where{ (it.id match_equal id) }
        }
    
        fun updateById (id: Int ): SqlUpdateClip<s_login_user_table,s_login_user> {
            return this.update().where{ (it.id match_equal id) }
        }
    
    
        fun queryByLoginName (loginName: String ): SqlQueryClip<s_login_user_table, s_login_user> {
            return this.query().where{ (it.loginName match_equal loginName) }
        }
    
    
        fun findByLoginName (loginName: String ): s_login_user? {
            return this.query().where{ (it.loginName match_equal loginName) }.limit(0,1).toEntity()
        }
    
        fun deleteByLoginName (loginName: String ): SqlDeleteClip<s_login_user_table,s_login_user> {
            return this.delete().where{ (it.loginName match_equal loginName) }
        }
    
        fun updateByLoginName (loginName: String ): SqlUpdateClip<s_login_user_table,s_login_user> {
            return this.update().where{ (it.loginName match_equal loginName) }
        }
    
    }
    
    class s_user_table(datasource:String=""):SqlBaseTable<s_user>(s_user::class.java,"s_user",datasource) {
        val id=SqlColumnName(DbType.Int,this.getAliaTableName(),"id")
        val name=SqlColumnName(DbType.String,this.getAliaTableName(),"name")
        val loginName=SqlColumnName(DbType.String,this.getAliaTableName(),"loginName")
        val code=SqlColumnName(DbType.String,this.getAliaTableName(),"code")
        val mobile=SqlColumnName(DbType.String,this.getAliaTableName(),"mobile")
        val isChecker=SqlColumnName(DbType.Boolean,this.getAliaTableName(),"isChecker")
        val isAdmin=SqlColumnName(DbType.Boolean,this.getAliaTableName(),"isAdmin")
        val isDisabled=SqlColumnName(DbType.Boolean,this.getAliaTableName(),"isDisabled")
        val token=SqlColumnName(DbType.String,this.getAliaTableName(),"token")
        val updateAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"updateAt")
        val createAt=SqlColumnName(DbType.DateTime,this.getAliaTableName(),"createAt")
    
        override fun getAutoIncrementKey(): String { return "id"}
        override fun getUks(): Array<Array<String>>{ return arrayOf( arrayOf("id") , arrayOf("loginName")  )}
        override fun getRks(): Array<Array<String>>{ return arrayOf( )}
        override fun getFks(): Array<FkDefine>{ return arrayOf()}
    
    
        fun queryById (id: Int ): SqlQueryClip<s_user_table, s_user> {
            return this.query().where{ (it.id match_equal id) }
        }
    
    
        fun findById (id: Int ): s_user? {
            return this.query().where{ (it.id match_equal id) }.limit(0,1).toEntity()
        }
    
        fun deleteById (id: Int ): SqlDeleteClip<s_user_table,s_user> {
            return this.delete().where{ (it.id match_equal id) }
        }
    
        fun updateById (id: Int ): SqlUpdateClip<s_user_table,s_user> {
            return this.update().where{ (it.id match_equal id) }
        }
    
    
        fun queryByLoginName (loginName: String ): SqlQueryClip<s_user_table, s_user> {
            return this.query().where{ (it.loginName match_equal loginName) }
        }
    
    
        fun findByLoginName (loginName: String ): s_user? {
            return this.query().where{ (it.loginName match_equal loginName) }.limit(0,1).toEntity()
        }
    
        fun deleteByLoginName (loginName: String ): SqlDeleteClip<s_user_table,s_user> {
            return this.delete().where{ (it.loginName match_equal loginName) }
        }
    
        fun updateByLoginName (loginName: String ): SqlUpdateClip<s_user_table,s_user> {
            return this.update().where{ (it.loginName match_equal loginName) }
        }
    
    }
}
